/**
 *  expander.vala
 *
 *  Copyright (c) 2007 Marcelo Lira dos Santos <setanta@gmail.com>
 *                2007 INdT (Instituto Nokia de Technologia)
 *
 *  Author: Marcelo Lira dos Santos <setanta@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as
 *  published by the Free Software Foundation; either version 2 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 *  USA
 */

using GLib;
using Gtk;

public class ExpanderDemo : GLib.Object
{

    public Window do_expander ()
    {
        Window window = Dialog.with_buttons ("GtkExpander", null,
                                             DialogFlags.DESTROY_WITH_PARENT,
                                             STOCK_CLOSE, ResponseType.NONE);
        window.resizable = false;
        ((Dialog) window).response += Gtk.main_quit;

        VBox vbox = new VBox(false, 5);
        ((Box) ((Dialog) window).vbox).pack_start(vbox, true, true, 0);
        vbox.border_width = 5;

        Label label = new Label("Expander demo. Click on the triangle for details.");
        vbox.pack_start(label, false, false, 0);

        Expander expander = new Expander("Details");
        vbox.pack_start(expander, false, false, 0);

        label = new Label("Details can be shown or hidden.");
        expander.add(label);

        return window;
    }

    static int main (string[] args) {
        Gtk.init(out args);

        ExpanderDemo ed = new ExpanderDemo();

        var win = ed.do_expander();
        try {
            win.set_default_icon_from_file("v-icon.png");
        } catch (GLib.Error error) {
            critical(error.message);
        }
        win.show_all();

        Gtk.main();

        return 0;
    }
}
